package com.yiduo.outpost.core.security.remote;

import com.yiduo.outpost.core.model.constant.SecurityConstant;
import com.yiduo.outpost.core.model.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * user center service remote apis
 *
 * @author yw
 */
@FeignClient(name = "ucenter")
public interface UCenterRemote {

    /**
     * Retrieve user info via jwt token
     *
     * @param token jwt
     * @return user info
     */
    @GetMapping("/sessions/fetch/by-token")
    User fetchByToken(@RequestHeader(SecurityConstant.AUTHORIZATION_HEADER) String token);

    /**
     * 通过用户id获取用户信息
     *
     * @param id 用户id
     * @return 用户信息
     */
    @GetMapping("/users/{id}")
    User getUser(@PathVariable("id") Long id, @RequestHeader(SecurityConstant.AUTHORIZATION_HEADER) String token);


}
